#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    int arr[10][10] = {0};
    for (int i = 0; i <= n - 1; i++)
    {
        for (int j = 0; j <= m - 1; j++)
        {
            scanf("%d", &arr[i][j]);

        }
    }

    for (int j = 0; j <= m - 1; j++)
    {
        for (int k = 0; k <= n - 1; k++)
        {
            printf("%d ", arr[k][j]); 
        }
        printf("\n");  
    }
    return 0;
}